<?php
	$path_one = 'admin/admin_system';
	$path_two = 'admin/boss';
	$filename = 'admin/boss_device';
	require_once("header.php");
	require_once("admin_comm.php");
	$boss_object=new boss();
	$page=request('page',false,true,false,1);
	$pagesize=request('pagesize',false,true,false,10);
	$data['uid']=request('uid',false,true,false,0);	
	$data['type']=request('type',false,true,false,0);
	$data['code']=request('code');
	$no_title=request('no_title',true);
	$result = $boss_object->_search_car($data,'*',$page,$pagesize);
	$hover[$data['type']]=' class="hover" ';

	$boss_rtn=$boss_object->boss_rtn();
	
	$query_str=http_build_query($data);
	$typedata=$data;
	unset($typedata['type']);
	$query_strtype=http_build_query($typedata);
?>
<script type="text/javascript" charset="utf-8">
	loader.file({
		plugin:['validform/main','dialog/main'],
		skincss:['list']
	})
	
    //修改记录
	function editinfo(id){
		dialog.iframe({
			title:'设备信息',
			is_resize:false,
			top:{
				is_show:true,
				btn_max:false,
				btn_min:false,
				btn_close:true,
				height:33,
				is_move:true
			},
			is_scroll:false,
			min_width:600,
			min_height:400,
			is_center:true,
			is_lock_back:true,
			content:'/admin/boss_carinfo?id='+id,
			name:'choise_project'
		});
	}		
</script>
</head>
<body>
	<div class="position_nav">你所在的当前位置：<?php echo $path_str;?></div>
		<div class="main">

			<div class="sos_box">
				<form action="/admin/boss_device" id="search" method='get'>
				    <input type="hidden" name="pid" id='pid' value="<?php echo $data['pid'] ;?>">
					<span>设备老板：</span>
					<select name='uid'>
					 <option value="">全部</option>
					 <?php 
					   if($boss_rtn){
                         foreach($boss_rtn as $val){
					 ?>
					   <option value="<?php echo $val['id'];?>" <?php echo $val['id']==$data['uid']?'selected':'';?>><?php echo $val['name']?></option>
					 <?php 
					   }}
					 ?>                          					 
					</select>				    
					<span>设备号：</span>					
					<input type="text" name='code'  value="<?php echo $data['code'];?>">
					<input class="button1" type="submit" value="搜索">
				</form>
			</div>
			<div class="power_nav">
				<ul>
					<li <?php echo $hover[0] ;?>>
						<a href="?type=0&<?php echo $query_strtype;?>">全部</a>
					</li>
					<li <?php echo $hover[1] ;?>>
						<a href="?type=1&<?php echo $query_strtype;?>">已绑定</a>
					</li>
					<li<?php echo $hover[2] ;?>>
						<a href="?type=2&<?php echo $query_strtype;?>">未绑定</a>
					</li>
					<li<?php echo $hover[3] ;?>>
						<a href="?type=3&<?php echo $query_strtype;?>">待续费</a>
					</li>					
				</ul>
			</div>
			<table cellpadding="0" cellspacing="1" border="0" class="table">
				<tr>
					<th align="center">序号</th>
					<th align="left">设备老板</th>
					<th align="left">车辆型号</th>
					<th align="left">车牌号码</th>
					<th align="left">绑定设备号</th>
					<th align="left">绑定时间</th>
					<th align="center">状态</th>					
					<th align="center">操作</th>
				</tr>
				<?php
					if($result['rows']){                                               
						foreach ($result['rows'] as $v){
                             $bossinfo=$boss_rtn[$v['uid']];
							?>
							<tr>
								<td align="center"><?php echo $v['id'] ;?></td>
								<td align="left"><?php echo $bossinfo['name'];?></td>
								<td align="left"><?php echo $v['car'] ;?></td>
								<td align="left"><?php echo $v['carno'] ;?></td>
								<td align="left"><?php echo $v['code'];?></td>
								<td align="left"><?php echo $v['bindtime']?date('Y-m-d H:i:s',$v['bindtime']):'';?></td>
								<td align="center"><?php $vo=car_state($v);echo $vo['msg'];?></td>								
								<td align="center">
								    <!-- <a href="javascript:;" onclick="editinfo(<?php echo $v['id']?>);">查看</a> | --> 
								    <a href="/admin/boss_cash_edit?id=<?php echo $v['id'];?>">查看</a>
								</td>
							</tr>
							<?php
						}
					}else{
						?>
						<tr>
							<td colspan="8">暂无数据！</td>
						</tr>
						<?php
					}
					if($result['page_count']>1){
				?>
				<tr>
					<td colspan="8">
						<div class="list_more">
							总数：<?php echo $result['row_count']?$result['row_count']:0 ;?>
							<?php
								echo page_method($result['row_count'], $page, $result['page_count'], 10, '/admin/boss_device?'.$query_str, false);
							?>
						</div>
					</td>
				</tr>
				<?php 
				 }
				?>
			</table>
		</div>
	</div>
</body>
</html>


